home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / Sound.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  21.6 KB  |  639 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        Sound.h
  3.  
  4.      Contains:    Sound Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __SOUND__
  21. #define __SOUND__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __MIXEDMODE__
  30. #include <MixedMode.h>
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_ALIGN_SUPPORTED
  38. #pragma options align=mac68k
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT_SUPPORTED
  42. #pragma import on
  43. #endif
  44.  
  45.  
  46.  
  47. /*
  48. Interface for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!
  49.  
  50. These items are no longer defined, but appear here so that someone
  51. searching the interfaces might find them. If you are using one of these
  52. items, you must change your code to support the Sound Manager.
  53.  
  54.     swMode, ftMode, ffMode
  55.     FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
  56.     SndCompletionProcPtr
  57.     StartSound, StopSound, SoundDone
  58. */
  59.  
  60.  
  61. #define twelfthRootTwo            1.05946309434
  62. enum {
  63.     soundListRsrc                = 'snd ',                        /*Resource type used by Sound Manager*/
  64.     rate44khz                    = 0xAC440000L,                    /*44100.00000 in fixed-point*/
  65.     rate22050hz                    = 0x56220000L,                    /*22050.00000 in fixed-point*/
  66.     rate22khz                    = 0x56EE8BA3L,                    /*22254.54545 in fixed-point*/
  67.     rate11khz                    = 0x2B7745D1L,                    /*11127.27273 in fixed-point*/
  68.     rate11025hz                    = 0x2B110000,                    /*11025.00000 in fixed-point*/
  69. /*synthesizer numbers for SndNewChannel*/
  70.     squareWaveSynth                = 1,                            /*square wave synthesizer*/
  71.     waveTableSynth                = 3,                            /*wave table synthesizer*/
  72.     sampledSynth                = 5,                            /*sampled sound synthesizer*/
  73. /*old Sound Manager MACE synthesizer numbers*/
  74.     MACE3snthID                    = 11,
  75.     MACE6snthID                    = 13,
  76.     kMiddleC                    = 60,                            /*MIDI note value for middle C*/
  77.     kSimpleBeepID                = 1,                            /*reserved resource ID for Simple Beep*/
  78.     kFullVolume                    = 0x0100,                        /*1.0, setting for full hardware output volume*/
  79.     kNoVolume                    = 0,                            /*setting for no sound volume*/
  80. /*command numbers for SndDoCommand and SndDoImmediate*/
  81.     nullCmd                        = 0,
  82.     initCmd                        = 1,
  83.     freeCmd                        = 2,
  84.     quietCmd                    = 3,
  85.     flushCmd                    = 4,
  86.     reInitCmd                    = 5,
  87.     waitCmd                        = 10,
  88.     pauseCmd                    = 11,
  89.     resumeCmd                    = 12,
  90.     callBackCmd                    = 13
  91. };
  92.  
  93. enum {
  94.     syncCmd                        = 14,
  95.     availableCmd                = 24,
  96.     versionCmd                    = 25,
  97.     totalLoadCmd                = 26,
  98.     loadCmd                        = 27,
  99.     freqDurationCmd                = 40,
  100.     restCmd                        = 41,
  101.     freqCmd                        = 42,
  102.     ampCmd                        = 43,
  103.     timbreCmd                    = 44,
  104.     getAmpCmd                    = 45,
  105.     volumeCmd                    = 46,                            /*sound manager 3.0 or later only*/
  106.     getVolumeCmd                = 47,                            /*sound manager 3.0 or later only*/
  107.     waveTableCmd                = 60,
  108.     phaseCmd                    = 61
  109. };
  110.  
  111. enum {
  112.     soundCmd                    = 80,
  113.     bufferCmd                    = 81,
  114.     rateCmd                        = 82,
  115.     continueCmd                    = 83,
  116.     doubleBufferCmd                = 84,
  117.     getRateCmd                    = 85,
  118.     rateMultiplierCmd            = 86,
  119.     getRateMultiplierCmd        = 87,
  120.     sizeCmd                        = 90,
  121.     convertCmd                    = 91,
  122.     stdQLength                    = 128,
  123.     dataOffsetFlag                = 0x8000
  124. };
  125.  
  126. /*channel initialization parameters*/
  127. #if OLDROUTINENAMES
  128. enum {
  129.     waveInitChannelMask            = 0x07,
  130.     waveInitChannel0            = 0x04,                            /*wave table only, Sound Manager 2.0 and earlier*/
  131.     waveInitChannel1            = 0x05,                            /*wave table only, Sound Manager 2.0 and earlier*/
  132.     waveInitChannel2            = 0x06,                            /*wave table only, Sound Manager 2.0 and earlier*/
  133.     waveInitChannel3            = 0x07,                            /*wave table only, Sound Manager 2.0 and earlier*/
  134.     initChan0                    = waveInitChannel0,                /*obsolete spelling*/
  135.     initChan1                    = waveInitChannel1,                /*obsolete spelling*/
  136.     initChan2                    = waveInitChannel2,                /*obsolete spelling*/
  137.     initChan3                    = waveInitChannel3                /*obsolete spelling*/
  138. };
  139.  
  140. #endif
  141. enum {
  142.     initChanLeft                = 0x0002,                        /*left stereo channel*/
  143.     initChanRight                = 0x0003,                        /*right stereo channel*/
  144.     initNoInterp                = 0x0004,                        /*no linear interpolation*/
  145.     initNoDrop                    = 0x0008,                        /*no drop-sample conversion*/
  146.     initMono                    = 0x0080,                        /*monophonic channel*/
  147.     initStereo                    = 0x00C0,                        /*stereo channel*/
  148.     initMACE3                    = 0x0300,                        /*MACE 3:1*/
  149.     initMACE6                    = 0x0400,                        /*MACE 6:1*/
  150.     initPanMask                    = 0x0003,                        /*mask for right/left pan values*/
  151.     initSRateMask                = 0x0030,                        /*mask for sample rate values*/
  152.     initStereoMask                = 0x00C0,                        /*mask for mono/stereo values*/
  153.     initCompMask                = 0xFF00,                        /*mask for compression IDs*/
  154.     kUseOptionalOutputDevice    = -1,                            /*only for Sound Manager 3.0 or later*/
  155.     notCompressed                = 0,                            /*compression ID's*/
  156.     fixedCompression            = -1,                            /*compression ID for fixed-sized compression*/
  157.     variableCompression            = -2,                            /*compression ID for variable-sized compression*/
  158.     twoToOne                    = 1,
  159.     eightToThree                = 2,
  160.     threeToOne                    = 3,
  161.     sixToOne                    = 4
  162. };
  163.  
  164. enum {
  165.     stdSH                        = 0x00,                            /*Standard sound header encode value*/
  166.     extSH                        = 0xFF,                            /*Extended sound header encode value*/
  167.     cmpSH                        = 0xFE                            /*Compressed sound header encode value*/
  168. };
  169.  
  170. enum {
  171.     outsideCmpSH                = 0,                            /*MACE constants*/
  172.     insideCmpSH                    = 1,
  173.     aceSuccess                    = 0,
  174.     aceMemFull                    = 1,
  175.     aceNilBlock                    = 2,
  176.     aceBadComp                    = 3,
  177.     aceBadEncode                = 4,
  178.     aceBadDest                    = 5,
  179.     aceBadCmd                    = 6,
  180.     sixToOnePacketSize            = 8,
  181.     threeToOnePacketSize        = 16,
  182.     stateBlockSize                = 64,
  183.     leftOverBlockSize            = 32,
  184.     firstSoundFormat            = 0x0001,                        /*general sound format*/
  185.     secondSoundFormat            = 0x0002,                        /*special sampled sound format (HyperCard)*/
  186.     dbBufferReady                = 0x00000001,                    /*double buffer is filled*/
  187.     dbLastBuffer                = 0x00000004,                    /*last double buffer to play*/
  188.     sysBeepDisable                = 0x0000,                        /*SysBeep() enable flags*/
  189.     sysBeepEnable                = 0x0001,
  190.     unitTypeNoSelection            = 0xFFFF,                        /*unitTypes for AudioSelection.unitType*/
  191.     unitTypeSeconds                = 0x0000
  192. };
  193.  
  194.  
  195.  
  196. /* unsigned fixed-point number */
  197. typedef unsigned long UnsignedFixed;
  198.  
  199. struct SndCommand {
  200.     unsigned short                    cmd;
  201.     short                            param1;
  202.     long                            param2;
  203. };
  204. typedef struct SndCommand SndCommand;
  205.  
  206. typedef struct SndChannel SndChannel;
  207.  
  208. typedef SndChannel *SndChannelPtr;
  209.  
  210. typedef pascal void (*SndCallBackProcPtr)(SndChannelPtr chan, SndCommand *cmd);
  211.  
  212. #if GENERATINGCFM
  213. typedef UniversalProcPtr SndCallBackUPP;
  214. #else
  215. typedef SndCallBackProcPtr SndCallBackUPP;
  216. #endif
  217.  
  218. struct SndChannel {
  219.     struct SndChannel                *nextChan;
  220.     Ptr                                firstMod;                    /* reserved for the Sound Manager */
  221.     SndCallBackUPP                    callBack;
  222.     long                            userInfo;
  223.     long                            wait;                        /* The following is for internal Sound Manager use only.*/
  224.     SndCommand                        cmdInProgress;
  225.     short                            flags;
  226.     short                            qLength;
  227.     short                            qHead;
  228.     short                            qTail;
  229.     SndCommand                        queue[stdQLength];
  230. };
  231.  
  232.  
  233. /*MACE structures*/
  234. struct StateBlock {
  235.     short                            stateVar[stateBlockSize];
  236. };
  237. typedef struct StateBlock StateBlock;
  238.  
  239. typedef StateBlock *StateBlockPtr;
  240.  
  241. struct LeftOverBlock {
  242.     unsigned long                    count;
  243.     char                            sampleArea[leftOverBlockSize];
  244. };
  245. typedef struct LeftOverBlock LeftOverBlock;
  246.  
  247. typedef LeftOverBlock *LeftOverBlockPtr;
  248.  
  249. struct ModRef {
  250.     unsigned short                    modNumber;
  251.     long                            modInit;
  252. };
  253. typedef struct ModRef ModRef;
  254.  
  255. struct SndListResource {
  256.     short                            format;
  257.     short                            numModifiers;
  258.     ModRef                            modifierPart[1];            /*This is a variable length array*/
  259.     short                            numCommands;
  260.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  261.     char                            dataPart[1];                /*This is a variable length array*/
  262. };
  263. typedef struct SndListResource SndListResource;
  264.  
  265. typedef SndListResource *SndListPtr;
  266.  
  267. typedef SndListPtr *SndListHndl, *SndListHandle;
  268.  
  269. /*HyperCard sound resource format*/
  270. struct Snd2ListResource {
  271.     short                            format;
  272.     short                            refCount;
  273.     short                            numCommands;
  274.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  275.     char                            dataPart[1];                /*This is a variable length array*/
  276. };
  277. typedef struct Snd2ListResource Snd2ListResource;
  278.  
  279. typedef Snd2ListResource *Snd2ListPtr;
  280.  
  281. typedef Snd2ListPtr *Snd2ListHndl, *Snd2ListHandle;
  282.  
  283. struct SoundHeader {
  284.     Ptr                                samplePtr;                    /*if NIL then samples are in sampleArea*/
  285.     unsigned long                    length;                        /*length of sound in bytes*/
  286.     UnsignedFixed                    sampleRate;                    /*sample rate for this sound*/
  287.     unsigned long                    loopStart;                    /*start of looping portion*/
  288.     unsigned long                    loopEnd;                    /*end of looping portion*/
  289.     unsigned char                    encode;                        /*header encoding*/
  290.     unsigned char                    baseFrequency;                /*baseFrequency value*/
  291.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  292. };
  293. typedef struct SoundHeader SoundHeader;
  294.  
  295. typedef SoundHeader *SoundHeaderPtr;
  296.  
  297. struct CmpSoundHeader {
  298.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  299.     unsigned long                    numChannels;                /*number of channels i.e. mono = 1*/
  300.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  301.     unsigned long                    loopStart;                    /*loopStart of sound before compression*/
  302.     unsigned long                    loopEnd;                    /*loopEnd of sound before compression*/
  303.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  304.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  305.     unsigned long                    numFrames;                    /*length in frames ( packetFrames or sampleFrames )*/
  306.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  307.     Ptr                                markerChunk;                /*sync track*/
  308.     OSType                            format;                        /*data format type, was futureUse1*/
  309.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  310.     StateBlockPtr                    stateVars;                    /*pointer to State Block*/
  311.     LeftOverBlockPtr                leftOverSamples;            /*used to save truncated samples between compression calls*/
  312.     short                            compressionID;                /*0 means no compression, non zero means compressionID*/
  313.     unsigned short                    packetSize;                    /*number of bits in compressed sample packet*/
  314.     unsigned short                    snthID;                        /*resource ID of Sound Manager snth that contains NRT C/E*/
  315.     unsigned short                    sampleSize;                    /*number of bits in non-compressed sample*/
  316.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  317. };
  318. typedef struct CmpSoundHeader CmpSoundHeader;
  319.  
  320. typedef CmpSoundHeader *CmpSoundHeaderPtr;
  321.  
  322. struct ExtSoundHeader {
  323.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  324.     unsigned long                    numChannels;                /*number of channels,  ie mono = 1*/
  325.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  326.     unsigned long                    loopStart;                    /*same meaning as regular SoundHeader*/
  327.     unsigned long                    loopEnd;                    /*same meaning as regular SoundHeader*/
  328.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  329.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  330.     unsigned long                    numFrames;                    /*length in total number of frames*/
  331.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  332.     Ptr                                markerChunk;                /*sync track*/
  333.     Ptr                                instrumentChunks;            /*AIFF instrument chunks*/
  334.     Ptr                                AESRecording;
  335.     unsigned short                    sampleSize;                    /*number of bits in sample*/
  336.     unsigned short                    futureUse1;                    /*reserved by Apple*/
  337.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  338.     unsigned long                    futureUse3;                    /*reserved by Apple*/
  339.     unsigned long                    futureUse4;                    /*reserved by Apple*/
  340.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  341. };
  342. typedef struct ExtSoundHeader ExtSoundHeader;
  343.  
  344. typedef ExtSoundHeader *ExtSoundHeaderPtr;
  345.  
  346. struct ConversionBlock {
  347.     short                            destination;
  348.     short                            unused;
  349.     CmpSoundHeaderPtr                inputPtr;
  350.     CmpSoundHeaderPtr                outputPtr;
  351. };
  352. typedef struct ConversionBlock ConversionBlock;
  353.  
  354. typedef ConversionBlock *ConversionBlockPtr;
  355.  
  356. struct SMStatus {
  357.     short                            smMaxCPULoad;
  358.     short                            smNumChannels;
  359.     short                            smCurCPULoad;
  360. };
  361. typedef struct SMStatus SMStatus;
  362.  
  363. typedef SMStatus *SMStatusPtr;
  364.  
  365. struct SCStatus {
  366.     UnsignedFixed                    scStartTime;
  367.     UnsignedFixed                    scEndTime;
  368.     UnsignedFixed                    scCurrentTime;
  369.     Boolean                            scChannelBusy;
  370.     Boolean                            scChannelDisposed;
  371.     Boolean                            scChannelPaused;
  372.     Boolean                            scUnused;
  373.     unsigned long                    scChannelAttributes;
  374.     long                            scCPULoad;
  375. };
  376. typedef struct SCStatus SCStatus;
  377.  
  378. typedef SCStatus *SCStatusPtr;
  379.  
  380. struct AudioSelection {
  381.     long                            unitType;
  382.     UnsignedFixed                    selStart;
  383.     UnsignedFixed                    selEnd;
  384. };
  385. typedef pascal void (*FilePlayCompletionProcPtr)(SndChannelPtr chan);
  386.  
  387. #if GENERATINGCFM
  388. typedef UniversalProcPtr FilePlayCompletionUPP;
  389. #else
  390. typedef FilePlayCompletionProcPtr FilePlayCompletionUPP;
  391. #endif
  392.  
  393. enum {
  394.     uppFilePlayCompletionProcInfo = kPascalStackBased
  395.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  396. };
  397.  
  398. #if GENERATINGCFM
  399. #define NewFilePlayCompletionProc(userRoutine)        \
  400.         (FilePlayCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, GetCurrentArchitecture())
  401. #else
  402. #define NewFilePlayCompletionProc(userRoutine)        \
  403.         ((FilePlayCompletionUPP) (userRoutine))
  404. #endif
  405.  
  406. #if GENERATINGCFM
  407. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  408.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, (chan))
  409. #else
  410. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  411.         (*(userRoutine))((chan))
  412. #endif
  413.  
  414. typedef struct AudioSelection AudioSelection;
  415.  
  416. typedef AudioSelection *AudioSelectionPtr;
  417.  
  418. struct SndDoubleBuffer {
  419.     long                            dbNumFrames;
  420.     long                            dbFlags;
  421.     long                            dbUserInfo[2];
  422.     char                            dbSoundData[1];
  423. };
  424. typedef struct SndDoubleBuffer SndDoubleBuffer;
  425.  
  426. typedef SndDoubleBuffer *SndDoubleBufferPtr;
  427.  
  428. typedef pascal void (*SndDoubleBackProcPtr)(SndChannelPtr channel, SndDoubleBufferPtr doubleBufferPtr);
  429.  
  430. #if GENERATINGCFM
  431. typedef UniversalProcPtr SndDoubleBackUPP;
  432. #else
  433. typedef SndDoubleBackProcPtr SndDoubleBackUPP;
  434. #endif
  435.  
  436. enum {
  437.     uppSndDoubleBackProcInfo = kPascalStackBased
  438.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  439.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndDoubleBufferPtr)))
  440. };
  441.  
  442. #if GENERATINGCFM
  443. #define NewSndDoubleBackProc(userRoutine)        \
  444.         (SndDoubleBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndDoubleBackProcInfo, GetCurrentArchitecture())
  445. #else
  446. #define NewSndDoubleBackProc(userRoutine)        \
  447.         ((SndDoubleBackUPP) (userRoutine))
  448. #endif
  449.  
  450. #if GENERATINGCFM
  451. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  452.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndDoubleBackProcInfo, (channel), (doubleBufferPtr))
  453. #else
  454. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  455.         (*(userRoutine))((channel), (doubleBufferPtr))
  456. #endif
  457.  
  458. struct SndDoubleBufferHeader {
  459.     short                            dbhNumChannels;
  460.     short                            dbhSampleSize;
  461.     short                            dbhCompressionID;
  462.     short                            dbhPacketSize;
  463.     UnsignedFixed                    dbhSampleRate;
  464.     SndDoubleBufferPtr                dbhBufferPtr[2];
  465.     SndDoubleBackUPP                dbhDoubleBack;
  466. };
  467. typedef struct SndDoubleBufferHeader SndDoubleBufferHeader;
  468.  
  469. typedef SndDoubleBufferHeader *SndDoubleBufferHeaderPtr;
  470.  
  471. struct SndDoubleBufferHeader2 {
  472.     short                            dbhNumChannels;
  473.     short                            dbhSampleSize;
  474.     short                            dbhCompressionID;
  475.     short                            dbhPacketSize;
  476.     UnsignedFixed                    dbhSampleRate;
  477.     SndDoubleBufferPtr                dbhBufferPtr[2];
  478.     SndDoubleBackUPP                dbhDoubleBack;
  479.     OSType                            dbhFormat;
  480. };
  481. typedef struct SndDoubleBufferHeader2 SndDoubleBufferHeader2;
  482.  
  483. typedef SndDoubleBufferHeader2 *SndDoubleBufferHeader2Ptr;
  484.  
  485. struct SoundInfoList {
  486.     short                            count;
  487.     Handle                            infoHandle;
  488. };
  489. typedef struct SoundInfoList SoundInfoList;
  490.  
  491. typedef SoundInfoList *SoundInfoListPtr;
  492.  
  493. struct CompressionInfo {
  494.     long                            recordSize;
  495.     OSType                            format;
  496.     short                            compressionID;
  497.     unsigned short                    samplesPerPacket;
  498.     unsigned short                    bytesPerPacket;
  499.     unsigned short                    bytesPerFrame;
  500.     unsigned short                    bytesPerSample;
  501.     unsigned short                    futureUse1;
  502. };
  503. typedef struct CompressionInfo CompressionInfo;
  504.  
  505. typedef CompressionInfo *CompressionInfoPtr;
  506.  
  507. typedef CompressionInfoPtr *CompressionInfoHandle;
  508.  
  509. /* These two routines for Get/SetSoundVol should no longer be used.*/
  510. /* They were for old Apple Sound Chip machines, and do not support the DSP or PowerMacs.*/
  511. /* Use Get/SetDefaultOutputVolume instead, if you must change the user's machine.*/
  512. #if OLDROUTINENAMES && !GENERATINGCFM
  513. extern pascal void SetSoundVol(short level);
  514.  
  515. #if !GENERATINGCFM
  516. #pragma parameter GetSoundVol(__A0)
  517. #endif
  518. extern pascal void GetSoundVol(short *level)
  519.  THREEWORDINLINE(0x4218, 0x10B8, 0x0260);
  520. #endif
  521.  
  522.  
  523. extern pascal OSErr SndDoCommand(SndChannelPtr chan, const SndCommand *cmd, Boolean noWait)
  524.  ONEWORDINLINE(0xA803);
  525. extern pascal OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand *cmd)
  526.  ONEWORDINLINE(0xA804);
  527. extern pascal OSErr SndNewChannel(SndChannelPtr *chan, short synth, long init, SndCallBackUPP userRoutine)
  528.  ONEWORDINLINE(0xA807);
  529. extern pascal OSErr SndDisposeChannel(SndChannelPtr chan, Boolean quietNow)
  530.  ONEWORDINLINE(0xA801);
  531. extern pascal OSErr SndPlay(SndChannelPtr chan, SndListHandle sndHdl, Boolean async)
  532.  ONEWORDINLINE(0xA805);
  533. #if OLDROUTINENAMES
  534. extern pascal OSErr SndAddModifier(SndChannelPtr chan, Ptr modifier, short id, long init)
  535.  ONEWORDINLINE(0xA802);
  536. #endif
  537. extern pascal OSErr SndControl(short id, SndCommand *cmd)
  538.  ONEWORDINLINE(0xA806);
  539.  
  540.  
  541. /* Sound Manager 2.0 and later, uses _SoundDispatch */
  542. extern pascal NumVersion SndSoundManagerVersion(void)
  543.  FOURWORDINLINE(0x203C, 0x000C, 0x0008, 0xA800);
  544. extern pascal OSErr SndStartFilePlay(SndChannelPtr chan, short fRefNum, short resNum, long bufferSize, void *theBuffer, AudioSelectionPtr theSelection, FilePlayCompletionUPP theCompletion, Boolean async)
  545.  FOURWORDINLINE(0x203C, 0x0D00, 0x0008, 0xA800);
  546. extern pascal OSErr SndPauseFilePlay(SndChannelPtr chan)
  547.  FOURWORDINLINE(0x203C, 0x0204, 0x0008, 0xA800);
  548. extern pascal OSErr SndStopFilePlay(SndChannelPtr chan, Boolean quietNow)
  549.  FOURWORDINLINE(0x203C, 0x0308, 0x0008, 0xA800);
  550. extern pascal OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus)
  551.  FOURWORDINLINE(0x203C, 0x0510, 0x0008, 0xA800);
  552. extern pascal OSErr SndManagerStatus(short theLength, SMStatusPtr theStatus)
  553.  FOURWORDINLINE(0x203C, 0x0314, 0x0008, 0xA800);
  554. extern pascal void SndGetSysBeepState(short *sysBeepState)
  555.  FOURWORDINLINE(0x203C, 0x0218, 0x0008, 0xA800);
  556. extern pascal OSErr SndSetSysBeepState(short sysBeepState)
  557.  FOURWORDINLINE(0x203C, 0x011C, 0x0008, 0xA800);
  558. extern pascal OSErr SndPlayDoubleBuffer(SndChannelPtr chan, SndDoubleBufferHeaderPtr theParams)
  559.  FOURWORDINLINE(0x203C, 0x0420, 0x0008, 0xA800);
  560.  
  561.  
  562. /* MACE compression routines */
  563. extern pascal NumVersion MACEVersion(void)
  564.  FOURWORDINLINE(0x203C, 0x0000, 0x0010, 0xA800);
  565. extern pascal void Comp3to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  566.  FOURWORDINLINE(0x203C, 0x0004, 0x0010, 0xA800);
  567. extern pascal void Exp1to3(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  568.  FOURWORDINLINE(0x203C, 0x0008, 0x0010, 0xA800);
  569. extern pascal void Comp6to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  570.  FOURWORDINLINE(0x203C, 0x000C, 0x0010, 0xA800);
  571. extern pascal void Exp1to6(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  572.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xA800);
  573.  
  574.  
  575. /* Sound Manager 3.0 and later calls */
  576. extern pascal OSErr GetSysBeepVolume(long *level)
  577.  FOURWORDINLINE(0x203C, 0x0224, 0x0018, 0xA800);
  578. extern pascal OSErr SetSysBeepVolume(long level)
  579.  FOURWORDINLINE(0x203C, 0x0228, 0x0018, 0xA800);
  580. extern pascal OSErr GetDefaultOutputVolume(long *level)
  581.  FOURWORDINLINE(0x203C, 0x022C, 0x0018, 0xA800);
  582. extern pascal OSErr SetDefaultOutputVolume(long level)
  583.  FOURWORDINLINE(0x203C, 0x0230, 0x0018, 0xA800);
  584. extern pascal OSErr GetSoundHeaderOffset(SndListHandle sndHandle, long *offset)
  585.  FOURWORDINLINE(0x203C, 0x0404, 0x0018, 0xA800);
  586. extern pascal UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed value, UnsignedFixed multiplier, UnsignedFixed divisor)
  587.  FOURWORDINLINE(0x203C, 0x060C, 0x0018, 0xA800);
  588. extern pascal OSErr GetCompressionInfo(short compressionID, OSType format, short numChannels, short sampleSize, CompressionInfoPtr cp)
  589.  FOURWORDINLINE(0x203C, 0x0710, 0x0018, 0xA800);
  590. extern pascal OSErr SetSoundPreference(OSType theType, Str255 name, Handle settings)
  591.  FOURWORDINLINE(0x203C, 0x0634, 0x0018, 0xA800);
  592. extern pascal OSErr GetSoundPreference(OSType theType, Str255 name, Handle settings)
  593.  FOURWORDINLINE(0x203C, 0x0638, 0x0018, 0xA800);
  594.  
  595.  
  596. /* Sound Manager 3.1 and later calls */
  597. extern pascal OSErr SndGetInfo(SndChannelPtr chan, OSType selector, void *infoPtr)
  598.  FOURWORDINLINE(0x203C, 0x063C, 0x0018, 0xA800);
  599. extern pascal OSErr SndSetInfo(SndChannelPtr chan, OSType selector, void *infoPtr)
  600.  FOURWORDINLINE(0x203C, 0x0640, 0x0018, 0xA800);
  601.  
  602.  
  603. enum {
  604.     uppSndCallBackProcInfo = kPascalStackBased
  605.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  606.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndCommand*)))
  607. };
  608.  
  609. #if GENERATINGCFM
  610. #define NewSndCallBackProc(userRoutine)        \
  611.         (SndCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndCallBackProcInfo, GetCurrentArchitecture())
  612. #else
  613. #define NewSndCallBackProc(userRoutine)        \
  614.         ((SndCallBackUPP) (userRoutine))
  615. #endif
  616.  
  617. #if GENERATINGCFM
  618. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  619.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndCallBackProcInfo, (chan), (cmd))
  620. #else
  621. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  622.         (*(userRoutine))((chan), (cmd))
  623. #endif
  624.  
  625.  
  626. #if PRAGMA_IMPORT_SUPPORTED
  627. #pragma import off
  628. #endif
  629.  
  630. #if PRAGMA_ALIGN_SUPPORTED
  631. #pragma options align=reset
  632. #endif
  633.  
  634. #ifdef __cplusplus
  635. }
  636. #endif
  637.  
  638. #endif /* __SOUND__ */
  639.